package com.cangxuan.backend.controller;

import com.cangxuan.backend.annotation.Check;
import com.cangxuan.backend.bean.Result;
import com.cangxuan.backend.entity.Banner;
import com.cangxuan.backend.service.IBannerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Delete;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 首页轮播图控制器
 * author:何程城
 */
@RestController
@RequestMapping("banner")
@Api(tags = "轮播图")
public class BannerController extends BaseController{

    IBannerService bannerService;

    @Autowired
    public void setBannerService(IBannerService bannerService) {
        this.bannerService = bannerService;
    }

    @GetMapping("list")
    @ApiOperation("获取首页轮播图列表")
    public Object getBanners(){
        List<String> list = bannerService.list();
        return success(list);
    }

    // @PutMapping("update")
    // @ApiOperation("修改轮播图")
    // public Object update(@Check @RequestBody Banner banner){
    //     bannerService.update(banner);
    //     return success("修改成功");
    // }
    //
    //
    // @DeleteMapping("delete/{id}")
    // @ApiOperation("根据ID删除banner")
    // public Object deleteById(@PathVariable int id){
    //     bannerService.delete(id);
    //     return success("删除成功");
    // }
}
